<link rel="stylesheet" href="ccay/example/demo.css"  type="text/css" />
<script type="text/javascript" src="ccay/example/demoimport/demoImport.js" charset="utf-8"></script>

<div id="demoImport">
<div title="Demo"  tabid='tab2'>
<form id="demoImportForm" class="init ccay-form">
	      <!--条件按钮区域-->
	      <div class="ccay-operate">
	         <input id="btnSearch" type=button  class="init i18n hasPermission" i18nKey="ccay.common.button.search" />
	      </div>
	</form> 
<h4><span>实例：导入</span></h4>
<div>
	<!--grid操作区域-->
	<div class="ccay-grid">
	 <div class="ccay-grid-toolbar">
	 	<input type="button" onclick="Ccay.example.demoImport.DemoImport(this)" i18nKey="ccay.common.button.import" class="init i18n hasPermission" ccayPermission="Service$IDemoImprot.Manage$import" >
	 	<input onclick="Ccay.example.demoImport.demoExport(this)" class="init i18n hasPermission"  ccayPermission="Service$IDemoExport.Manage$export" i18nKey="ccay.common.button.export" type="button">
	 		<a href="servlet/download?dlType=ExcelTemplate&excelType=ccay.example" i18nKey="ccay.common.label.importTemplate" class="init i18n hasPermission" ccayPermission="Service$IDemoImprot.Manage$import"></a>
	 </div>
	 <!--数据表格-->
	 <div id="demoImportGrid"></div>
	</div>
	<div style="float: left;">
		<span>备注：该Demo只展示界面样式，以及所具有的功能。首先下载模板,填充数据后再执行导入操作</span>
	</div>
</div>
</div>
<div title="功能描述" tabid='tab3'>
<h4><span>----------导入----------</span></h4><br>
		<h3>html 源码:</h3>
		<div class="codeArea">
			<pre id='html1'>
			&lt;input type="button" onclick="Ccay.example.demoImport.DemoImport(this)" 
			i18nKey="ccay.common.button.import" class="init i18n hasPermission" 
			ccayPermission="Service$IDemoImprot.Manage$import" >
			</pre>
		</div>
		<h3>js 源码:</h3>
		<div class="codeArea">
			<pre id='js1'>
			page.DemoImport = function() {
				var param = {
					uploadType : "ExcelImport",
					completeCallback : Ccay.Component.Excel.uploadCallback,
					closeDialog : true,
					query : "excelType=ccay.example",
					maxFileCount : 1
				};
			Ccay.Component.openUploadDialog("Demo Import", param);
			}
			</pre>
		</div>

<h4><span>----------导出----------</span></h4><br>
		<h3>html 源码:</h3>
		<div class="codeArea">
			<pre id='html2'>
			&lt;input onclick="Ccay.example.demoImport.demoExport(this)" class="init i18n hasPermission"
			ccayPermission="Service$IDemoExport.Manage$export" 
			i18nKey="ccay.common.button.export" type="button">
			</pre>
		</div>
		<h3>js 源码:</h3>
		<div class="codeArea">
			<pre id='js2'>
			page.demoExport = function() {
				if (!$S("#demoImportForm").valid())
				return;
				Ccay.doGet("services/ccay/example/demoExport/list/export",
				$S("#demoImportForm").jsonData(), function() {
				Ccay.Component.Excel.exportCallback();
				});
			}
			</pre>
		</div>

<h4><span>----------添加错误信息----------</span></h4><br>
		<h3>手动添加错误信息</h3>
		<div class="codeArea">
			<pre id='java1'>
				//方法类    fail  end方法中都行
				List<ExcelCellError> cellErrorList=new ArrayList<ExcelCellError>();//创建excel错误信息
				cellErrorList.add(new ExcelCellError("zh", 1, "1", "错误"));  //添加错误信息
				context.addCellErrors(cellErrorList);//增加excel错误信息
			</pre>
		</div>
		
		<h3>查询添加错误信息</h3>
		<div class="codeArea">
			
			<pre id='java2'>
			    @Inject
				private IImportTaskService importTaskService; //导入消费类申明
			    
			    //方法类    fail  end方法中都行
				List<ExcelCellError> cellErrorList=new ArrayList<ExcelCellError>();//创建excel错误信息
				ImportErrorsVO importErrorsVO=new ImportErrorsVO();
				importErrorsVO.setTaskId(context.getRequest().getTaskId());//设置taskId
				//根据taskId查询错误信息
				List<ImportErrorsVO> importcellErrorList=importTaskService.findImportErrorsList(importErrorsVO);
				for(int i=0;i&lt;importcellErrorList.size();i++){
				ImportErrorsVO errorsVO=importcellErrorList.get(i);
				cellErrorList.add(new ExcelCellError(errorsVO.getSheetName(), errorsVO.getRowno(),"", errorsVO.getErrorMessage()));
				}
				context.addCellErrors(cellErrorList);//增加excel错误信息
			</pre>
		</div>
		
		<span>导入begin方法：主要用于导入前的操作，例如：纪录日记、初始化变量等；fail跟end方法：主要用于添加错误信息</span>
</div>
</div>